package com.itheima.homework.异常.自定义异常;

public class Demo4 {
    public static void main(String[] args) {
        Student s=new Student();
        s.setName("张三三");
        try {
            s.setAge(19);
            s.setSex("a");
        }catch (AgeException a){
            a.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
class AgeException extends RuntimeException{
    public AgeException() {
    }

    public AgeException(String message) {
        super(message);
    }
}
class SexException extends RuntimeException{
    public SexException() {
    }

    public SexException(String message) {
        super(message);
    }
}
